/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 26727
 * Date: 2024-09-08
 * Time: 19:55
 */
import java.util.Scanner;

public class ReverseSubstringInput {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        // 读取字符串s
        int n = scanner.nextInt();
        int k = scanner.nextInt();
        String s = scanner.nextLine();

        scanner.nextLine(); // 消耗掉nextInt后的换行符
        StringBuilder sb = new StringBuilder(s);

        // 依次翻转从i到i+k-1的子串
        for (int i = 0; i <= n - k; i++) {
            // 翻转子串并替换
//            StringBuilder reversedSubstring = sb.substring(i, i + k).reverse().toString();
//            sb.replace(i, i + k, reversedSubstring.toString());
        }

        // 输出最终状态的字符串
        System.out.println(sb.toString());
    }
}